package com.akiokevin.plantyourlife.schedule;

/**
 * Contains data for each schedule entry.
 * 
 * @Author Akio Akazawa
 */
public class ScheduleEntry implements Comparable<ScheduleEntry>{
	private String mDescription;
	private int mHour;
	private int mMinute;
	private ScheduleEntryResult mResult;
	
	public ScheduleEntry() {
	}
	public ScheduleEntry(String desc, int hour, int minute, ScheduleEntryResult result) {
		setDescription(desc);
		setHour(hour);
		setMinute(minute);
		setResult(result);
	}
	public int compareTo(ScheduleEntry entry) {
		int thisTime = mHour * 100 + mMinute;
		int otherTime = entry.getHour() * 100 + entry.getMinute();
		if(thisTime > otherTime) {
			return 1;
		}
		if(thisTime < otherTime) {
			return -1;
		}
		return 0;
	}
	
	// Description properties
	public String getDescription() {
		return mDescription;
	}
	public void setDescription(String desc) {
		mDescription = desc;
	}
	// Time properties
	public int getHour() { 
		return mHour;
	}
	public void setHour(int hour) {
		mHour = hour;
	}
	public int getMinute() {
		return mMinute;
	}
	public void setMinute(int minute) {
		mMinute = minute;
	}
	public String getTimeString() {
		String time = "";
		time += ((mHour < 10)? "0" : "") + mHour;
		time += ((mMinute < 10)? "0" : "") + mMinute;
		return time;
	}
	public void setTime(int hour, int minute) {
		setHour(hour);
		setMinute(minute);
	}
	// Result properties
	public ScheduleEntryResult getResult() {
		return mResult;
	}
	public void setResult(ScheduleEntryResult result) {
		mResult = result;
	}
}
